<!DOCTYPE html>
<html>
<head>

<meta charset=utf-8 />
<meta name="author" content="CERN LineMode Crew 2013" />
<meta name="description" content="All about remaking the line mode browser." />
<!-- CONTROL SCALE FOR MOBILE DEVICES IF NEEDED -->
<meta name="viewport" content="width=device-width, minimum-scale=1.0" />

<title>Behind the scenes building a line-mode browser in 2013</title>

<link href="../css/gridset.css" rel="stylesheet" />
<link href="../css/main.css" rel="stylesheet" />


<link href='http://fonts.googleapis.com/css?family=PT+Sans+Narrow:400,700|PT+Serif:400,700,400italic|PT+Sans+Caption:400,700' rel='stylesheet' type='text/css'>

</head>
<body style="background-color: #f7f7f7">

	<div class="headfill" style="background-image: url(../img/makingof-header.jpg);"></div>

	<div class="wrapper">

		<div id="content" class="clearfix">

			<section class="d-all">
				<!--h4 class="date">Geneva, 30 April 2013</h4-->

				<h1>Making of LMB 2013</h1>
				<h2>Rebuilding 20 year old software in a modern day browser</h2>
				<nav>
					<ul>
						<li class="lmb lmblaunch"><a href="/www/hypertext/WWW/TheProject.html">Launch Line Mode Browser</a></li>
						<li><a href="../">Home</a></li>
						<li><a href="../interviews/">Interviews</a></li>
						<li class="selected"><a href="../makingof/">Making of</a></li>
						<li><a href="../resources/">Resources</a></li>
					</ul>
				</nav>

				<article>
					<div class="d-all">
						<p class="standfirst">In late September, 2013, twelve web developers, designers, writers, standardistas, and technologists descended upon CERN — the birthplace of WWW and HTTP and the web browser — to spend two days rebuilding the line-mode browser. This is our story.</p>
					</div>

				</article>


				<article class="d-all">

					<h3>Preservationistas</h3>

					<p>We hear you ask: <em>This is silly; rebuild a 20 year old browser? Why?</em></p>

					<p>Computers are simultaneously boosted and hindered by their rapid obsolescence. So while the line-mode browser is a mere 20 years old (as of the writing of this), it's only viewable (and barely usable) on the odd terminal here in the closet of CERN. We've come so far in so few years that we're on the cusp of not being able to interact with the very software that got us here. As folks who believe deeply in — and owe much to — the web, this pains us. In rebuilding / simulating this origin browser, we hope to achieve a few goals.</p>

					<p>First, we want to provide <strong>context for the web of today</strong>. From where did it come? Out of what did it grow? Despite being only 20 years old, the qualitative differences between then and now are shocking. It's nice to be able to time-travel back and peek at our roots.</p>

					<p>Which brings us to the second reason: we want <strong>a version of the line-mode browser that anyone can run</strong> and, furthermore, point at contemporary websites. Our line-mode browser simulator not only allows you to view the first web pages ever placed online (on these very servers!), but will also render — as accurately as possible — any other website to which it's pointed. It may not always be pretty, but it's usually entertaining. (And heck, the web was never really meant to be that pretty, right?<sup>1</sup>)</p>


					<img src="../img/makingof-04.jpg" />
					<h3>Our Rules</h3>

					<p>In simulating the line-mode browser, we had a couple of rules.</p>

					<ol>
					<li>We wanted to be as true to the original rendering engine as possible. That meant not adding features or improving the display of elements in any way different than the original.</li>
					</ol>

					<h3>Our Guidelines</h3>

					<p>Beyond rendering early web content faithfully, as the linemode browser would have we, we also wanted to capture some of the experience of using this early browser on an old "dumb" terminal. This included</p>

					<ol>
						<li>The effect of the characters being drawn one by one onto the screen, as the browser parsed, and then rendered content <em>character by character</em>. </li>
						<li>The distinctive sound of the clunking keyboard typically associate with the dumb terminals used with the linemode browser </li>
					</ol>


					<div class="d1 d-floatleft">
						<img src="../img/makingof-02.jpg" style="margin-top: 20px;" alt="Pushing buttons on an old terminal keyboard feeling quite confused" title="Pushing buttons on an old terminal keyboard feeling quite confused" />
					</div>
					<h3>What tech did we use?</h3>

					<p><strong>In short</strong>: We wrote an old browser in a new browser. Here are the details.</p>

					<p>The approach we centered on was to use a proxy Node server. This allowed us to request arbitrary web resources (we’d run into CORS problems with many sites).</p>

					<p>In the node app, we manipulate the DOM, disabling scripts and style (linked, embedded and inline). But, importantly, we leave the script, link and style elements in place. <em>Why?</em> we hear you ask. Because, dear reader, the original line mode browser would display contents of those tags. Its parsing rule was to strip the start and end tags off unknown elements, but display their content inline. So it would display the content of style, link and script elements, but would not be affected by them, which is why we disabled them. It may look messy but we're being as true as possible to the way the line-mode browser worked.</p>

					<p>After the DOM is modified like this, we add links to the CSS and JavaScript files that drive the emulation, then serialise the document back into a string, and then send this to the browser.</p>

					<p>The browser then parses the document, applies the CSS and runs the JavaScript, so you the user can experience the awesomeness that was the line mode browser.</p>

					<p>The CSS was used for 90% of the appearance of the document, with JavaScript used for some positional aspects. For example, JS was used for visual tricks and runs the command line fixed to the bottom of the content. Technically, this would be possible with CSS, but the required features, including viewport units aren’t supported across all widely used browsers.</p>

<p>In addition we use the HTML5 audio element to bring you the sound of the keyboard (we even recorded the sounds of typing on an old IBM RS6000 keyboard we had at our disposal to work with an early version of the browser).</p>

					<div class="d1 d-floatleft">
						<img src="../img/makingof-01.jpg" />
					</div>
					<h3>What hacks did we use?</h3>
					<p>Hacks! We do not hack. OK, maybe we did some hacky things, but thankfully nothing particularly grubby.</p>
					<p>As mentioned, we used some JavaScript for calculating certain aspects of the page layout. We'd have preferred to have done this in pure CSS.</p>
					<p>Actually, there's one hack that was pretty cool. As mentioned, the original browser parsed and then drew to the screen character by character. Which basically means you see the browser draw, quite quickly, but still very noticeably, each character to the screen,. We wanted to emulate this, as it is as much a part of the original experience as the monochrome screen, or monospace font used.</p>
					<p>Our original idea was to use CSS animations for this. But, this would require wrapping every individual character in a <code>span</code> element, then showing each character one by one.</p>
					<p>Then in most likely a caffeine fuelled brainstorm, we came up with the idea of covering the document with a black, opaque <code>canvas</code>, then repeatedly erasing a rectangle the size of a character column by column, line by line. This works really well because it's a monospace font, all displayed at the same font size, so we don't need to measure the size of each character we're erasing, as each will be identical in size. This ended up being far less work than the original approach, and after a bit of tweaking, works like a charm.</p>
					<h3>Will what we built today be usable in 10 years? </h3>
					<p>We hope so! One of the things we wanted to do is emulate how the line-mode browser would handle today’s web content. Even though, technically, the original line-mode terminals would choke on today's heavy pages — we're averaging about 1.2MB of content per page.</p>

					<p>But we think — are pretty certain — that this bundle of HTML, CSS and JavaScript will be usable for more than 10 years. At least we hope so!</p>

				</article>

				<div class="footnotes d-all">
					<h3>Footnotes</h3>
					<ol>
						<li>OK — that not <em>entirreeeeely</em> true. Remember how we said this wasn't the first browser? Well, the first browser was very pretty, and very graphical. It ran on the NeXT desktop and not only had style sheet support (!!) but also handled vector graphics.</li>
					</ol>
				</div>
			</section>
		</div>

		<footer>
			<p>For press enquiries, please contact the CERN press office at <a href="mailto:press@cern.ch">press@cern.ch</a></p>
			<hr/>
			<p><a href="http://cern.ch/copyright">© Copyright CERN 2013</a></p>

		</footer>

	</div>
</body>
</html>